package com.chenyun.service.impl.impl;

import com.chenyun.mapper.UserMapper;
import com.chenyun.pojo.User;
import com.chenyun.service.impl.UserService;
import com.chenyun.utils.Md5Util;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public User selectByUserName(String username) {
        User user=userMapper.selectByUserName(username);
        return user;
    }

    @Override
    public void register(String username, String password) {
        //加密
        String md5String = Md5Util.getMD5String(password);

        //添加
        userMapper.add(username,md5String);

    }
}
